Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2996 +/- ##
==========================================
+ Coverage 83.29% 84.23% +0.93%
==========================================
Files 42 44 +2
Lines 35378 36193 +815
Branches 35378 36193 +815
==========================================
+ Hits 29469 30486 +1017
+ Misses 2456 2341 -115
+ Partials 3453 3366 -87 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Adds the lexer, parser and AST of the v2 parser from the 2.0 proposal (apache#2893) as a separate crate, sqlparser_v2, without its serde, visitor and comment support. sqlparser does not depend on it yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sqlparser::v2::parse_sql parses with the v2 parser and converts its AST to this crate's AST, for the built-in dialects that v2 has. GenericDialect and AnsiDialect have no v2 equivalent and are rejected. Nodes with no conversion yet fail with Error::Unconverted, and parse_sql_with_fallback retries those with this crate's parser. compare runs both parsers. tests/sqlparser_v2.rs checks every statement in tests/v2_corpus.txt against this crate's parser in each dialect: a converted AST must equal this crate's, apart from the cases in v2_known_differences.txt, where the two parsers read the SQL differently. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
andygrove
force-pushed
the
v2-bridge-prototype
branch
from
November 18, 2026 16:02
a2d4be7 to
9e7b50c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dialects: none
Experimental, not ready to merge. I am experimenting with how the v2 parser proposed in #2893 could be added incrementally, without breaking changes to the existing AST. I am opening this to get feedback on the approach.
This adds the v2 lexer, parser and AST as a separate crate,
sqlparser_v2. Its serde, visitor and comment support are left out, since the conversion does not need them.It also adds an opt-in
v2feature tosqlparser.sqlparser::v2::parse_sqlparses with v2 and converts the result to the existing AST, so callers can try the new parser without changing their code. Nothing changes for users who do not enable the feature.GenericDialectandAnsiDialecthave no v2 equivalent and are rejected. Only queries are converted so far. Anything else fails withError::Unconverted, andparse_sql_with_fallbackretries those with the existing parser.compareruns both parsers, for checking a downstream test suite against v2.tests/sqlparser_v2.rsruns every statement in v2's corpus through both parsers in each dialect. 14,640 conversions produce the same AST as the existing parser. 307 differ because the two parsers read the SQL differently, and are listed intests/v2_known_differences.txt. The test fails on a new difference, or if the number of matching conversions drops.With PostgreSQL, v2 plus the conversion is faster than the existing parser (
sqlparser_bench/benches/v2_bridge.rs):SELECT * FROM my_table WHERE 1 = 1WITHquery with a joinThe code in this PR was written by Claude (Claude Code). The design is mine, and I understand it well, but I have not reviewed every line of the code.